import { CommonI, IndividualI, RoleI, WeixinOauthI } from "./system";
import { Dayjs } from "dayjs";

export interface WeixinOauthReqI {
	code: string;
	state: string;
}

export interface CellphoneRegisterReqI {
	cellphone: string;
	verifyCode: string;
	oauth: WeixinOauthI;
}

export interface VerifyCodeReqI {
	cellphone: string;
	captchaID?: string;
	vcode?: string;
}

export interface CaptchaI {
	captchaID: string;
	imageUrl: string;
}

export interface LoginReqI {
	username: string;
	password: string;
	// vcode: string;
	// captchaID: string;
}

export interface ChangePasswordReqI {
	id: string;
	oldPassword: string;
	newPassword: string;
	newPasswordAgain: string;
}

export interface RegisterReqI {
	username: string;
	password: string;
	password1: string;
	full_name?: string;
	role?: RoleI;
	is_superuser?: boolean;
}

export interface ModelParamsI {
	initReservoirCapacity: number;
	reservoirDecayFactor: number;
	sleepDebtFactor: number;
	circadianFactor: number;
	sleepInertiaFactor: number;
	sleepInertiaMax: number;
	sleepInertiaFactorT: number;
	circadian24Peak: number;
	circadian12Peak: number;
	circadian12Factor: number;
	a1: number;
	a2: number;
	k1: number;
	k2: number;
	k3: number;
	sleepHour: number;
	awakeHour: number;
}

export interface SafteResultI {
	datetime: Date | string;
	Ct: number;
	Et: number;
	I: number;
	RCt: number;
	Rt: number;
	RtPercentage: number;
	SD: number;
	SI: number;
	SP: number;
	ct: number;
	performance: number;
	status: string;
}

export interface DeprivationI {
	duration: number;
	reservoir: number;
}

export interface ExpDeprivationI extends CommonI {
	individualId: string;
	individual?: IndividualI;
	duration: number;
	reservoir: number;
}

export interface ScheduleI extends CommonI {
	individualId: string;
	individual?: IndividualI;
	code: string;
	comment: string;
	jetLag: number;
	scheduleDetails: ScheduleDetailI[];
	tasks: TaskI[];
	experiments: ExperimentI[];
}

export interface ScheduleDetailI extends CommonI {
	awakeTime: Dayjs;
	sleepTime: Dayjs;
	sleepQuality: number;
}

export interface TaskI extends CommonI {
	scheduleId: string;
	schedule?: ScheduleI;
	startTime: Dayjs;
	endTime: Dayjs;
	intensity: number;
	maxPerformance?: number;
	minPerformance?: number;
	meanPerformance?: number;
	status: number;
	comment?: string;
}

export interface ExperimentI extends CommonI {
	scheduleId: string;
	schedule?: ScheduleI;
	measureTime: Dayjs;
	measureType: string;
	measureResult: number;
	performance?: number;
	status: number;
	comment?: string;
}
